home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Developer Utilities / Installer 4.0.3 SDK / Script Examples / Install PowerMac [ compressed ] / NotPPC / NotPPC.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-15  |  1.9 KB  |  70 lines  |  [TEXT/MPS ]

  1. /*
  2.  
  3.     NotPPC.c
  4.  
  5.         Source code for NotPPC application to provide a warning
  6.         when PowerMac Native Mode application is launched on a
  7.         68K machine.
  8.         
  9.         Note: This module has been observed to put up only a partial
  10.         error message when launched under System 7.5. It does however
  11.         look find under System 7.1.
  12.  
  13. */
  14.  
  15. #include <dialogs.h>
  16. #include <QuickDraw.h>
  17. #include <Dialogs.h>
  18. #include <Windows.h>
  19. #include <Resources.h>
  20. #include <Memory.h>
  21. #include "NotPPC.h"
  22.  
  23. // When using 3.3.1 or newer MPW these are no longer in Dialogs.h, so we put them here.  If you're using an
  24. // older MPW then comment out the following lines.
  25. pascal void CouldAlert(short alertID)
  26.  = 0xA989; 
  27. pascal void FreeAlert(short alertID)
  28.  = 0xA98A; 
  29.  
  30.  
  31. void main ()
  32. {
  33.     short        itemHit;
  34.     AlertTHndl    theAlertTemplate;
  35.     Handle        theDITLHandle;
  36.     Handle        theMessageHandle;
  37.     Boolean        canAlert;
  38.  
  39.     InitGraf ((Ptr)&qd.thePort);
  40.     InitWindows ();
  41.     InitDialogs (NULL);
  42.  
  43.     /* set cursor to an arrow */
  44.     SetCursor (&qd.arrow);
  45.  
  46.     /* pre-flight everything first */
  47.     theAlertTemplate = (AlertTHndl)GetResource ('ALRT', RESOURCE_ID);        /* is the ALRT resource around? */
  48.     theDITLHandle = GetResource ('DITL', (*theAlertTemplate)->itemsID);        /* how about the DITL? */
  49.     theMessageHandle = GetResource ('STR ', RESOURCE_ID);                    /* check the STR resource, too */
  50.  
  51.     CouldAlert (RESOURCE_ID);                                                /* is there enough memory to handle the alert? */
  52.     canAlert = (ResError() == noErr) && (MemError() == noErr);
  53.     FreeAlert (RESOURCE_ID);                                                /* free the memory */
  54.  
  55.     if ((theAlertTemplate) || (theDITLHandle) || (theMessageHandle) || (canAlert))
  56.     {
  57.         /* Success at last... */
  58.         HLock( theMessageHandle );
  59.         ParamText (*(theMessageHandle), "", "", "");                        /* use the loaded STR resource to replace ^0 in alert's DITL */
  60.         itemHit = Alert (RESOURCE_ID, nil);                                    /* run the alert */
  61.     }
  62.     else
  63.     {
  64.         /* give some indication we're hosed... */
  65.         SysBeep(2); 
  66.     }
  67. }
  68.  
  69.  
  70.